﻿#include "FITKAcousticsVTKGraphObjectSEADoubleCurveShells.h"

// VTK
#include <vtkProperty.h>
#include <vtkMultiBlockDataSet.h>
#include <vtkCompositeDataGeometryFilter.h>
#include <vtkExtractBlock.h>

// Data
#include "FITK_Component/FITKAcousticsModel/FITKAbstractSEASubSys.h"

// Graph and filter
#include "FITKAcousticsVTKCommons.h"
#include "FITKAcousticsVTKSharedDataManager.h"
#include "FITKAcousticsVTKGraphObjectSEASelectMergedData.h"
#include "FITK_Interface/FITKVTKAlgorithm/FITKGraphActor.h"

namespace Exchange
{
    FITKAcousticsVTKGraphObjectSEADoubleCurveShells::FITKAcousticsVTKGraphObjectSEADoubleCurveShells(Acoustics::FITKAcousticsSEAModel* seaModel)
        : FITKAcousticsVTKGraphObjectSEAShellsBase(seaModel)
    {
        if (!seaModel)
        {
            return;
        }

        // Intiailize the polygon offset.
        m_polygonOffset = FITKAcousticsVTKCommons::s_polygonOffsetSEAShell;

        // Initialize the SEA sub-systems type.
        m_SEASubSysTypeEnum = Acoustics::FITKAbstractSEASubSys::SEASubSysType::SEADoublyCurvedShell;

        // Intialize the filter.
        init();

        // Generate the multi block dataset.
        if (!generateDataSet())
        {
            return;
        }

        // Generate the actor.
        generateGraph();

        // Update the visibility.
        updateVisibility();
    }

    bool FITKAcousticsVTKGraphObjectSEADoubleCurveShells::getDataVisibility()
    {
        // Get the runtime settings for visibility.
        bool showDCShell = getRuntimeSettingAs<bool>(RTS_KEY_VISIBLE_SEA_SUBSYS_D_CUR_PLATE, true);
        return this->Superclass::getDataVisibility() && showDCShell;
    }
}   // namespace Exchange